package com.itheima.zy;

import java.util.Arrays;
import java.util.Random;

public class Test19 {
    public static void main(String[] args) {
        int[] q = new int[10];
        Random b = new Random();
        for (int i = 0; i < q.length; i++) {
            q[i] = b.nextInt(20)+1;
            for (int k = 0; k < i; k++) {
                if (q[k] == q[i]) {
                   i--;
                }
            }
        }
        System.out.println(Arrays.toString(q));
//        for (int i = 0, h = q.length - 1; i < h; i++, h--) {
//
//
//            int a = q[i];
//            q[i] = q[h];
//            q[h] = a;
//
//        }
        int temp = 0;
        int max = q[0];
        int min = q[0];
        for (int i = 0; i < q.length; i++) {

            temp += q[i];
            if (q[i] > max) {
                max = q[i];
            } else if (q[i] < min) {
                min = q[i];
            }
        }
        System.out.println("--------------------------");
        System.out.println("总和值：" + temp);
        System.out.println("最大值：" + max);
        System.out.println("最小值：" + min);
        System.out.println("平均值：" + temp / q.length);
    }
}
